

package cn.shengchao.examstar.distribute.infrastrure.service.impl;

import cn.shengchao.examstar.rpc.distribute.enums.DistributeDataStatusEnum;
import cn.shengchao.examstar.rpc.distribute.enums.DistributeTypeEnum;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.shengchao.examstar.distribute.infrastrure.mapper.DistributeRoleDefaultPercentMapper;
import cn.shengchao.examstar.distribute.infrastrure.po.DistributeRoleDefaultPercent;
import cn.shengchao.examstar.distribute.infrastrure.service.DistributeRoleDefaultPercentService;

@Service
public class DistributeRoleDefaultPercentServiceImpl extends ServiceImpl<DistributeRoleDefaultPercentMapper, DistributeRoleDefaultPercent> implements DistributeRoleDefaultPercentService {
    @Override
    public DistributeRoleDefaultPercent getSalePercentByRoleCode(String roleCode) {
        DistributeRoleDefaultPercent distributeRoleDefaultPercent = getOne(Wrappers
            .lambdaQuery(DistributeRoleDefaultPercent.class)
            .eq(DistributeRoleDefaultPercent::getRoleCode, roleCode)
            .eq(DistributeRoleDefaultPercent::getDistributeType, DistributeTypeEnum.TYPE_SALE.getType())
            .eq(DistributeRoleDefaultPercent::getDataStatus, DistributeDataStatusEnum.STATUS_CURT.getStatus()));
        return distributeRoleDefaultPercent;
    }

    @Override
    public DistributeRoleDefaultPercent getContentByRoleCode(String roleCode) {
        DistributeRoleDefaultPercent distributeRoleDefaultPercent = getOne(Wrappers
            .lambdaQuery(DistributeRoleDefaultPercent.class)
            .eq(DistributeRoleDefaultPercent::getRoleCode, roleCode)
            .eq(DistributeRoleDefaultPercent::getDistributeType, DistributeTypeEnum.TYPE_CTPD.getType())
            .eq(DistributeRoleDefaultPercent::getDataStatus, DistributeDataStatusEnum.STATUS_CURT.getStatus()));
        return distributeRoleDefaultPercent;
    }
}
